package Lee_code;

public class Lee_922 {
    public int[] sortArrayByParityII(int[] nums) {
        int ou = 0;
        int ji = 1;

        while(ji < nums.length && ou<nums.length){
            if(nums[ou]%2==0)
            {
                ou+=2;
            }

            if(nums[ji]%2!=1)
            {
                ji+=2;
            }

            int temp = nums[ou];
            nums[ou] =nums[ji];
            nums[ji] = temp;
        }
        return nums;
    }
}
